﻿<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected decimal[] Data;
        protected string Notice = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                Date1.Text = DateTime.Today.AddDays(-1).ToString("yyyy年M月d日");

                if ((object)Session["OperatorDID"] != null)
                {
                    int did = (int)Session["OperatorDID"];
                    if (did != 0)
                    {
                        if (did == 1)
                        {
                            this.FenChang.Items.RemoveAt(1);
                            this.FenChang.Items.RemoveAt(1);
                            this.FenChang.Items.RemoveAt(1);
                            this.FenChang.Items.RemoveAt(1);
                        }
                        else if (did == 2)
                        {
                            this.ChanPin.Text = "2";
                            
                            this.FenChang.Items.RemoveAt(0);
                            this.FenChang.Items.RemoveAt(2);
                            this.FenChang.Items.RemoveAt(2);

                            ListItem li=new ListItem();
                            li.Text = "二分厂";
                            li.Value = "200";
                            this.FenChang.Items.Insert(0, li);
                            
                        }
                        else if (did == 5)
                        {
                            this.FenChang.Items.RemoveAt(0);
                            this.FenChang.Items.RemoveAt(0);
                            this.FenChang.Items.RemoveAt(0);
                        }

                    }
                }
            }
        }
</script>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<%
    DateTime d1,d2,d3;
    int fc, scx;
    scx = int.Parse(this.FenChang.Text);
    fc = scx / 100;
    scx = scx % 100;
    this.Data = new decimal[270];
    
    if (!DateTime.TryParse(this.Date1.Text, out d1))
    {
        this.Notice = "日期录入有误";
        goto outdoor;
    }
    if (this.ChanPin.Text == "1" || this.ChanPin.Text == "2")
    {
        this.GangJi.Text = "J55";
    }
    else
    {
        this.GangJi.Text = "N80";
    }
    if (this.ChanPin.Text == "1" || this.ChanPin.Text == "3")
    {
        this.GuiGe.Text = "Φ73.02×5.51";
    }
    else
    {
        this.GuiGe.Text = "Φ139.7×7.72";
    }

    System.Data.SqlClient.SqlConnection Conn = new System.Data.SqlClient.SqlConnection();
    Conn.ConnectionString = ConfigurationManager.ConnectionStrings["SCMConnectionString1"].ConnectionString;
    Conn.Open();
    System.Data.SqlClient.SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
    Cmd.Connection = Conn;

    Cmd.CommandText = @"declare @y int
declare @d1 smalldatetime
if exists(select * from 生产月设置 where 分厂=@fc and @d0>=起始日期 and @d0<=截止日期)
begin
    select @y=年度,@d1=起始日期 from 生产月设置 where 分厂=@fc and @d0>=起始日期 and @d0<=截止日期
    if exists(select * from 生产月设置 where 分厂=@fc and 年度=@y and 月份=1)
    begin
	    select @d1 as 月累计日期,起始日期 as 年累计日期 from 生产月设置 where 分厂=@fc and 年度=@y and 月份=1
    end
end";
    Cmd.CommandText = Cmd.CommandText.Replace("@d0", "'" + d1.ToShortDateString() + "'");
    Cmd.CommandText = Cmd.CommandText.Replace("@fc", fc.ToString());
    System.Data.SqlClient.SqlDataReader Reader = Cmd.ExecuteReader();
    if (Reader.Read())
    {
        d2 = (DateTime)Reader["月累计日期"];
        d3 = (DateTime)Reader["年累计日期"];
        this.Date2.Text = d2.ToLongDateString();
        this.Date3.Text = d3.ToLongDateString();
    }
    else
    {
        this.Date2.Text = d1.Year.ToString() + "年" + d1.Month.ToString() + "月1日";
        this.Date3.Text = d1.Year.ToString() + "年1月1日";
        d2 = DateTime.Parse(this.Date2.Text);
        d3 = DateTime.Parse(this.Date3.Text);
    }
    Reader.Close();
    Cmd.CommandText = "生产日报数据";
    Cmd.CommandType = System.Data.CommandType.StoredProcedure;

    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@分厂ID", System.Data.SqlDbType.Int, 4, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, fc));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@生产线", System.Data.SqlDbType.Int, 
        4, System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, scx));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@产品类别ID", System.Data.SqlDbType.Int, 4, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, int.Parse(this.ChanPin.Text)));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d1", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d1));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d2", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d2));
    Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@d3", System.Data.SqlDbType.Date, 3, 
        System.Data.ParameterDirection.Input, true, 0, 0, "", System.Data.DataRowVersion.Proposed, d3));

    Reader = Cmd.ExecuteReader();
    int x = 0;
    int gongduan;
    while (Reader.Read())
    {
        if (Reader.IsDBNull(2)) continue;
        if ((int)Reader["类别"] == 0)
        {
            x = 0;
        }
        else if ((int)Reader["类别"] == 1)
        {
            x = 120;
        }
        else
        {
            x = 240;
        }
        gongduan = (int)Reader["工段"];
        if (gongduan > 0 && gongduan <= 4)
        {
            x += (gongduan - 1) * 30;
        }
        Data[x + 0] = (int)Reader["计划支数"];
        Data[x + 1] = (decimal)Reader["计划重量"];
        Data[x + 2] = (int)Reader["投入支数"];
        Data[x + 3] = (decimal)Reader["投入重量"];
        Data[x + 4] = (int)Reader["机紧1"];
        Data[x + 5] = (int)Reader["机紧2"];
        Data[x + 6] = (int)Reader["静水压"];
        Data[x + 7] = (int)Reader["称测支数"];
        Data[x + 8] = (decimal)Reader["称测长度"];
        Data[x + 9] = (decimal)Reader["称测重量"];
        Data[x + 10] = (int)Reader["包装支数"];
        Data[x + 11] = (int)Reader["包装捆数"];
        Data[x + 12] = (decimal)Reader["包装长度"];
        Data[x + 13] = (decimal)Reader["包装重量"];
        Data[x + 14] = (int)Reader["入库支数"];
        Data[x + 15] = (int)Reader["入库捆数"];
        Data[x + 16] = (decimal)Reader["入库长度"];
        Data[x + 17] = (decimal)Reader["入库重量"];
        Data[x + 18] = (int)Reader["未入库支数"];
        Data[x + 19] = (decimal)Reader["未入库重量"];

        Data[x + 20] = (int)Reader["车丝1"];
        Data[x + 21] = (int)Reader["车丝2"];
        Data[x + 22] = (int)Reader["车丝3"];
        Data[x + 23] = (int)Reader["车丝4"];
        Data[x + 24] = (int)Reader["车丝5"];
        Data[x + 25] = (int)Reader["车丝6"];
        Data[x + 26] = (int)Reader["车丝7"];
        Data[x + 27] = (int)Reader["车丝8"];
        Data[x + 28] = (int)Reader["车丝9"];
        Data[x + 29] = (int)Reader["车丝10"];
    }
    Reader.Close();
    
    Reader.Dispose();
    Cmd.Dispose();
    Conn.Close();
    Conn.Dispose();
outdoor: ;
%>

<div id="wintop" class="wintop"><%=this.FenChang.SelectedItem.Text %> <%=this.ChanPin.SelectedItem.Text%>管体日生产报表
<font style="font-size:14px;font-weight:normal;"><span style="margin-left:50px;"></span>年累计：<asp:Label ID="Date3" runat="server" Text="" Width="100px"></asp:Label><span style="margin-left:10px;"></span>月累计：<asp:Label ID="Date2" runat="server" Text="" Width="100px"></asp:Label></font>
</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
生产单位：<asp:DropDownList ID="FenChang" runat="server" Width="103px" AutoPostBack="true">
    <asp:ListItem Value="101">一分厂</asp:ListItem>
    <asp:ListItem Value="201">二分厂1号线</asp:ListItem>
    <asp:ListItem Value="202">二分厂2号线</asp:ListItem>
    <asp:ListItem Value="501">五分厂1号线</asp:ListItem>
    <asp:ListItem Value="502">五分厂2号线</asp:ListItem>
</asp:DropDownList>
<span style="margin-left:10px;"></span>
<!-- =================================================================================================== -->
<!-- ========                               产品类别列表                                     =========== -->
<!-- ========                                                                               =========== -->
<!-- =================================================================================================== -->
<asp:SqlDataSource ID="DS_ChanPin" runat="server" 
                   ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                    SelectCommand="SELECT [ID],[品名]+' '+[钢级]+' '+[规格] AS 名称 FROM [产品]" >
</asp:SqlDataSource>
产品：
<asp:DropDownList ID="ChanPin" runat="server" Width="150px" Font-Size="12px" DataSourceID="DS_ChanPin" 
                               DataTextField="名称" DataValueField="ID" AutoPostBack="true">
</asp:DropDownList>
<!-- =================================================================================================== -->
<span style="margin-left:10px;"></span>日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="110px"  AutoPostBack="true"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
<span style="margin-left:10px;"></span><input type="button" value="导出Excel" class="button" onclick="Export();"/>
</asp:Panel>
<asp:Label ID="GangJi" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="GuiGe" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="BianHao" runat="server" Text="" Visible="false"></asp:Label>


<asp:Panel ID="Panel2" runat="server" CssClass="panel3">
<style type="text/css">
td.bb{border:0.5pt solid black;text-align:center;padding:0.5pt;font-size:11pt;height:23px;font-family:宋体;}
td.nb{border:none;text-align:center;padding:0.5pt;font-size:11pt;height:23px;font-family:宋体;}
</style>
<table border=0 cellpadding=0 style=border-collapse:collapse;>
<tr>
<td colspan=13 class=nb style=font-size:18pt;font-weight:bold;height:28pt;><%=this.ChanPin.SelectedItem.Text.Substring(0,2) %>管体日生产报表</td>
</tr>
<tr>
<td class=nb colspan=2>生产：<%=this.FenChang.SelectedItem.Text %></td>
<td class=nb colspan=2>日期：<%=this.Date1.Text %></td>
<td class=nb colspan=2>品种：<%=this.ChanPin.SelectedItem.Text.Substring(0,2) %>管体</td>
<td class=nb colspan=2>钢级：<%=this.GangJi.Text%></td>
<td class=nb colspan=3>规格(mm)：<%=this.GuiGe.Text%></td>
<td class=nb colspan=2>编号：SYC/ZJ-GT-13</td>
</tr>
<tr>
<td class=bb colspan=2 rowspan=2 style='text-align:left;mso-diagonal-down:.5pt solid windowtext;'>　　　　　　产量<br>　类别</td>
<td class=bb colspan=2>甲班组</td>
<td class=bb colspan=2>乙班组</td>
<td class=bb colspan=2>丙班组</td>
<td class=bb colspan=2>丁班组</td>
<td class=bb colspan=2>合计</td>
<td class=bb rowspan=2>年累计</td>
</tr>
<tr>
<td class=bb>当日</td>
<td class=bb>本月累计</td>
<td class=bb>当日</td>
<td class=bb>本月累计</td>
<td class=bb>当日</td>
<td class=bb>本月累计</td>
<td class=bb>当日</td>
<td class=bb>本月累计</td>
<td class=bb>当日</td>
<td class=bb>本月累计</td>
</tr>
<tr>
<td class=bb rowspan=2 width=50>原料<br>计划</td>
<td class=bb width=90>根数</td>
<td class=bb width=75><%=this.Data[0] %></td>
<td class=bb width=85><%=this.Data[120] %></td>
<td class=bb width=75><%=this.Data[30] %></td>
<td class=bb width=85><%=this.Data[150] %></td>
<td class=bb width=75><%=this.Data[60] %></td>
<td class=bb width=85><%=this.Data[180] %></td>
<td class=bb width=75><%=this.Data[90] %></td>
<td class=bb width=85><%=this.Data[210] %></td>
<td class=bb width=75><%=this.Data[0] + this.Data[30] + this.Data[60] + this.Data[90]%></td>
<td class=bb width=85><%=this.Data[120] + this.Data[150] + this.Data[180] + this.Data[210]%></td>
<td class=bb width=100><%=this.Data[240] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[1] %></td>
<td class=bb><%=this.Data[121] %></td>
<td class=bb><%=this.Data[31] %></td>
<td class=bb><%=this.Data[151] %></td>
<td class=bb><%=this.Data[61] %></td>
<td class=bb><%=this.Data[181] %></td>
<td class=bb><%=this.Data[91] %></td>
<td class=bb><%=this.Data[211] %></td>
<td class=bb><%=this.Data[1] + this.Data[31] + this.Data[61] + this.Data[91]%></td>
<td class=bb><%=this.Data[121] + this.Data[151] + this.Data[181] + this.Data[211]%></td>
<td class=bb><%=this.Data[241] %></td>
</tr>
<tr>
<td class=bb rowspan=2>原料<br>投入</td>
<td class=bb>根数</td>
<td class=bb><%=this.Data[2] %></td>
<td class=bb><%=this.Data[122] %></td>
<td class=bb><%=this.Data[32] %></td>
<td class=bb><%=this.Data[152] %></td>
<td class=bb><%=this.Data[62] %></td>
<td class=bb><%=this.Data[182] %></td>
<td class=bb><%=this.Data[92] %></td>
<td class=bb><%=this.Data[212] %></td>
<td class=bb><%=this.Data[2] + this.Data[32] + this.Data[62] + this.Data[92]%></td>
<td class=bb><%=this.Data[122] + this.Data[152] + this.Data[182] + this.Data[212]%></td>
<td class=bb><%=this.Data[242] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[3] %></td>
<td class=bb><%=this.Data[123] %></td>
<td class=bb><%=this.Data[33] %></td>
<td class=bb><%=this.Data[153] %></td>
<td class=bb><%=this.Data[63] %></td>
<td class=bb><%=this.Data[183] %></td>
<td class=bb><%=this.Data[93] %></td>
<td class=bb><%=this.Data[213] %></td>
<td class=bb><%=this.Data[3] + this.Data[33] + this.Data[63] + this.Data[93]%></td>
<td class=bb><%=this.Data[123] + this.Data[153] + this.Data[183] + this.Data[213]%></td>
<td class=bb><%=this.Data[243] %></td>
</tr>
<tr>

<%
    int fc, scx;
    scx = int.Parse(this.FenChang.Text);
    fc = scx / 100;
    scx = scx % 100;
    int i;
    decimal[] xj=new decimal[11];
    decimal t1, t2;
    if (fc == 1)//一分厂
    {
        Response.Write("<td class=bb rowspan=5>车丝<br>根数</td>");
        for (i = 0; i < 4; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];
            
            Response.Write("<td class=bb>"+(i+1)+"#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );
            
        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
    else if (fc == 2 && scx==0)//二分厂
    {
        Response.Write("<td class=bb rowspan=7>车丝<br>根数</td>");
        for (i = 0; i < 6; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];

            Response.Write("<td class=bb>" + (i + 1) + "#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );

        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
        
    else if (fc == 2 && scx==1)//二分厂油管
    {
        Response.Write("<td class=bb rowspan=5>车丝<br>根数</td>");
        for (i = 0; i < 2; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];

            Response.Write("<td class=bb>" + (i + 1) + "#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );

        }
        for (i = 0; i < 2; i++)
        {
            Response.Write("<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n</tr>\n<tr>\n"
                );
        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
    else if (fc == 2 && scx == 2)//二分厂套管
    {
        Response.Write("<td class=bb rowspan=5>车丝<br>根数</td>");
        for (i = 2; i < 6; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];

            Response.Write("<td class=bb>" + (i + 1) + "#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );

        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
    else if (fc == 5 && scx==1)//五分厂1号线
    {
        Response.Write("<td class=bb rowspan=5>车丝<br>根数</td>");
        for (i = 0; i < 2; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];

            Response.Write("<td class=bb>" + (i + 1) + "#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );

        }
        for (i = 0; i < 2; i++)
        {
            Response.Write("<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n</tr>\n<tr>\n"
                );
        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
    else if (fc == 5 && scx == 2)//五分厂2号线
    {
        Response.Write("<td class=bb rowspan=5>车丝<br>根数</td>");
        for (i = 2; i < 4; i++)
        {
            t1 = this.Data[20 + i] + this.Data[50 + i] + this.Data[80 + i] + this.Data[110 + i];
            t2 = this.Data[140 + i] + this.Data[170 + i] + this.Data[200 + i] + this.Data[230 + i];
            xj[0] += this.Data[20 + i];
            xj[1] += this.Data[140 + i];
            xj[2] += this.Data[50 + i];
            xj[3] += this.Data[170 + i];
            xj[4] += this.Data[80 + i];
            xj[5] += this.Data[200 + i];
            xj[6] += this.Data[110 + i];
            xj[7] += this.Data[230 + i];
            xj[8] += t1;
            xj[9] += t2;
            xj[10] += this.Data[260 + i];

            Response.Write("<td class=bb>" + (i + 1) + "#</td>\n"
                + "<td class=bb>" + this.Data[20 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[140 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[50 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[170 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[80 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[200 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[110 + i] + "</td>\n"
                + "<td class=bb>" + this.Data[230 + i] + "</td>\n"
                + "<td class=bb>" + t1 + "</td>\n"
                + "<td class=bb>" + t2 + "</td>\n"
                + "<td class=bb>" + this.Data[260 + i] + "</td>\n</tr>\n<tr>\n"
                );

        }
        for (i = 0; i < 2; i++)
        {
            Response.Write("<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n</tr>\n<tr>\n"
                );
        }
        Response.Write("<td class=bb>小计</td>\n");
        for (i = 0; i < 11; i++)
        {
            Response.Write("<td class=bb>" + xj[i] + "</td>\n");
        }
        Response.Write("</tr>\n");
    }
    else
    {
        for (i = 0; i < 5; i++)
        {
            Response.Write("<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n"
                + "<td class=bb></td>\n</tr>\n<tr>\n"
                );
        }
    }
%>
<tr>
<td class=bb rowspan=2>机紧</td>
<td class=bb>(自)合格</td>
<td class=bb><%=this.Data[4] %></td>
<td class=bb><%=this.Data[124] %></td>
<td class=bb><%=this.Data[34] %></td>
<td class=bb><%=this.Data[154] %></td>
<td class=bb><%=this.Data[64] %></td>
<td class=bb><%=this.Data[184] %></td>
<td class=bb><%=this.Data[94] %></td>
<td class=bb><%=this.Data[214] %></td>
<td class=bb><%=this.Data[4] + this.Data[34] + this.Data[64] + this.Data[94]%></td>
<td class=bb><%=this.Data[124] + this.Data[154] + this.Data[184] + this.Data[214]%></td>
<td class=bb><%=this.Data[244] %></td>
</tr>
<tr>
<td class=bb>外购接箍</td>
<td class=bb><%=this.Data[5] %></td>
<td class=bb><%=this.Data[125] %></td>
<td class=bb><%=this.Data[35] %></td>
<td class=bb><%=this.Data[155] %></td>
<td class=bb><%=this.Data[65] %></td>
<td class=bb><%=this.Data[185] %></td>
<td class=bb><%=this.Data[95] %></td>
<td class=bb><%=this.Data[215] %></td>
<td class=bb><%=this.Data[5] + this.Data[35] + this.Data[65] + this.Data[95]%></td>
<td class=bb><%=this.Data[125] + this.Data[155] + this.Data[185] + this.Data[215]%></td>
<td class=bb><%=this.Data[245] %></td>
</tr>
<tr>
<td class=bb>静水压</td>
<td class=bb>合格</td>
<td class=bb><%=this.Data[6] %></td>
<td class=bb><%=this.Data[126] %></td>
<td class=bb><%=this.Data[36] %></td>
<td class=bb><%=this.Data[156] %></td>
<td class=bb><%=this.Data[66] %></td>
<td class=bb><%=this.Data[186] %></td>
<td class=bb><%=this.Data[96] %></td>
<td class=bb><%=this.Data[216] %></td>
<td class=bb><%=this.Data[6] + this.Data[36] + this.Data[66] + this.Data[96]%></td>
<td class=bb><%=this.Data[126] + this.Data[156] + this.Data[186] + this.Data[216]%></td>
<td class=bb><%=this.Data[246] %></td>
</tr>
<tr>
<td class=bb rowspan=3>称重<br>测长</td>
<td class=bb>根数</td>
<td class=bb><%=this.Data[7] %></td>
<td class=bb><%=this.Data[127] %></td>
<td class=bb><%=this.Data[37] %></td>
<td class=bb><%=this.Data[157] %></td>
<td class=bb><%=this.Data[67] %></td>
<td class=bb><%=this.Data[187] %></td>
<td class=bb><%=this.Data[97] %></td>
<td class=bb><%=this.Data[217] %></td>
<td class=bb><%=this.Data[7] + this.Data[37] + this.Data[67] + this.Data[97]%></td>
<td class=bb><%=this.Data[127] + this.Data[157] + this.Data[187] + this.Data[217]%></td>
<td class=bb><%=this.Data[247] %></td>
</tr>
<tr>
<td class=bb>长度(m)</td>
<td class=bb><%=this.Data[8] %></td>
<td class=bb><%=this.Data[128] %></td>
<td class=bb><%=this.Data[38] %></td>
<td class=bb><%=this.Data[158] %></td>
<td class=bb><%=this.Data[68] %></td>
<td class=bb><%=this.Data[188] %></td>
<td class=bb><%=this.Data[98] %></td>
<td class=bb><%=this.Data[218] %></td>
<td class=bb><%=this.Data[8] + this.Data[38] + this.Data[68] + this.Data[98]%></td>
<td class=bb><%=this.Data[128] + this.Data[158] + this.Data[188] + this.Data[218]%></td>
<td class=bb><%=this.Data[248] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[9] %></td>
<td class=bb><%=this.Data[129] %></td>
<td class=bb><%=this.Data[39] %></td>
<td class=bb><%=this.Data[159] %></td>
<td class=bb><%=this.Data[69] %></td>
<td class=bb><%=this.Data[189] %></td>
<td class=bb><%=this.Data[99] %></td>
<td class=bb><%=this.Data[219] %></td>
<td class=bb><%=this.Data[9] + this.Data[39] + this.Data[69] + this.Data[99]%></td>
<td class=bb><%=this.Data[129] + this.Data[159] + this.Data[189] + this.Data[219]%></td>
<td class=bb><%=this.Data[249] %></td>
</tr>
<tr>
<td class=bb rowspan=4>成品<br>包装</td>
<td class=bb>根数</td>
<td class=bb><%=this.Data[10] %></td>
<td class=bb><%=this.Data[130] %></td>
<td class=bb><%=this.Data[40] %></td>
<td class=bb><%=this.Data[160] %></td>
<td class=bb><%=this.Data[70] %></td>
<td class=bb><%=this.Data[190] %></td>
<td class=bb><%=this.Data[100] %></td>
<td class=bb><%=this.Data[220] %></td>
<td class=bb><%=this.Data[10] + this.Data[40] + this.Data[70] + this.Data[100]%></td>
<td class=bb><%=this.Data[130] + this.Data[160] + this.Data[190] + this.Data[220]%></td>
<td class=bb><%=this.Data[250] %></td>
</tr>
<tr>
<td class=bb>捆数</td>
<td class=bb><%=this.Data[11] %></td>
<td class=bb><%=this.Data[131] %></td>
<td class=bb><%=this.Data[41] %></td>
<td class=bb><%=this.Data[161] %></td>
<td class=bb><%=this.Data[71] %></td>
<td class=bb><%=this.Data[191] %></td>
<td class=bb><%=this.Data[101] %></td>
<td class=bb><%=this.Data[221] %></td>
<td class=bb><%=this.Data[11] + this.Data[41] + this.Data[71] + this.Data[101]%></td>
<td class=bb><%=this.Data[131] + this.Data[161] + this.Data[191] + this.Data[221]%></td>
<td class=bb><%=this.Data[251] %></td>
</tr>
<tr>
<td class=bb>长度(m)</td>
<td class=bb><%=this.Data[12] %></td>
<td class=bb><%=this.Data[132] %></td>
<td class=bb><%=this.Data[42] %></td>
<td class=bb><%=this.Data[162] %></td>
<td class=bb><%=this.Data[72] %></td>
<td class=bb><%=this.Data[192] %></td>
<td class=bb><%=this.Data[102] %></td>
<td class=bb><%=this.Data[222] %></td>
<td class=bb><%=this.Data[12] + this.Data[42] + this.Data[72] + this.Data[102]%></td>
<td class=bb><%=this.Data[132] + this.Data[162] + this.Data[192] + this.Data[222]%></td>
<td class=bb><%=this.Data[252] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[13] %></td>
<td class=bb><%=this.Data[133] %></td>
<td class=bb><%=this.Data[43] %></td>
<td class=bb><%=this.Data[163] %></td>
<td class=bb><%=this.Data[73] %></td>
<td class=bb><%=this.Data[193] %></td>
<td class=bb><%=this.Data[103] %></td>
<td class=bb><%=this.Data[223] %></td>
<td class=bb><%=this.Data[13] + this.Data[43] + this.Data[73] + this.Data[103]%></td>
<td class=bb><%=this.Data[133] + this.Data[163] + this.Data[193] + this.Data[223]%></td>
<td class=bb><%=this.Data[253] %></td>
</tr>
<tr>
<td class=bb rowspan=4>入库量</td>
<td class=bb>根数</td>
<td class=bb><%=this.Data[14] %></td>
<td class=bb><%=this.Data[134] %></td>
<td class=bb><%=this.Data[44] %></td>
<td class=bb><%=this.Data[164] %></td>
<td class=bb><%=this.Data[74] %></td>
<td class=bb><%=this.Data[194] %></td>
<td class=bb><%=this.Data[104] %></td>
<td class=bb><%=this.Data[224] %></td>
<td class=bb><%=this.Data[14] + this.Data[44] + this.Data[74] + this.Data[104]%></td>
<td class=bb><%=this.Data[134] + this.Data[164] + this.Data[194] + this.Data[224]%></td>
<td class=bb><%=this.Data[254] %></td>
</tr>
<tr>
<td class=bb>捆数</td>
<td class=bb><%=this.Data[15] %></td>
<td class=bb><%=this.Data[135] %></td>
<td class=bb><%=this.Data[45] %></td>
<td class=bb><%=this.Data[165] %></td>
<td class=bb><%=this.Data[75] %></td>
<td class=bb><%=this.Data[195] %></td>
<td class=bb><%=this.Data[105] %></td>
<td class=bb><%=this.Data[225] %></td>
<td class=bb><%=this.Data[15] + this.Data[45] + this.Data[75] + this.Data[105]%></td>
<td class=bb><%=this.Data[135] + this.Data[165] + this.Data[195] + this.Data[225]%></td>
<td class=bb><%=this.Data[255] %></td>
</tr>
<tr>
<td class=bb>长度(m)</td>
<td class=bb><%=this.Data[16] %></td>
<td class=bb><%=this.Data[136] %></td>
<td class=bb><%=this.Data[46] %></td>
<td class=bb><%=this.Data[166] %></td>
<td class=bb><%=this.Data[76] %></td>
<td class=bb><%=this.Data[196] %></td>
<td class=bb><%=this.Data[106] %></td>
<td class=bb><%=this.Data[226] %></td>
<td class=bb><%=this.Data[16] + this.Data[46] + this.Data[76] + this.Data[106]%></td>
<td class=bb><%=this.Data[136] + this.Data[166] + this.Data[196] + this.Data[226]%></td>
<td class=bb><%=this.Data[256] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[17] %></td>
<td class=bb><%=this.Data[137] %></td>
<td class=bb><%=this.Data[47] %></td>
<td class=bb><%=this.Data[167] %></td>
<td class=bb><%=this.Data[77] %></td>
<td class=bb><%=this.Data[197] %></td>
<td class=bb><%=this.Data[107] %></td>
<td class=bb><%=this.Data[227] %></td>
<td class=bb><%=this.Data[17] + this.Data[47] + this.Data[77] + this.Data[107]%></td>
<td class=bb><%=this.Data[137] + this.Data[167] + this.Data[197] + this.Data[227]%></td>
<td class=bb><%=this.Data[257] %></td>
</tr>
<tr>
<td class=bb rowspan=2>未入<br>库量</td>
<td class=bb>根数</td>
<td class=bb><%=this.Data[18] %></td>
<td class=bb><%=this.Data[138] %></td>
<td class=bb><%=this.Data[48] %></td>
<td class=bb><%=this.Data[168] %></td>
<td class=bb><%=this.Data[78] %></td>
<td class=bb><%=this.Data[198] %></td>
<td class=bb><%=this.Data[108] %></td>
<td class=bb><%=this.Data[228] %></td>
<td class=bb><%=this.Data[18] + this.Data[48] + this.Data[78] + this.Data[108]%></td>
<td class=bb><%=this.Data[138] + this.Data[168] + this.Data[198] + this.Data[228]%></td>
<td class=bb><%=this.Data[258] %></td>
</tr>
<tr>
<td class=bb>重量(kg)</td>
<td class=bb><%=this.Data[19] %></td>
<td class=bb><%=this.Data[139] %></td>
<td class=bb><%=this.Data[49] %></td>
<td class=bb><%=this.Data[169] %></td>
<td class=bb><%=this.Data[79] %></td>
<td class=bb><%=this.Data[199] %></td>
<td class=bb><%=this.Data[109] %></td>
<td class=bb><%=this.Data[229] %></td>
<td class=bb><%=this.Data[19] + this.Data[49] + this.Data[79] + this.Data[109]%></td>
<td class=bb><%=this.Data[139] + this.Data[169] + this.Data[199] + this.Data[229]%></td>
<td class=bb><%=this.Data[259] %></td>
</tr>
<tr>
<td class=nb></td>
<td class=nb style=text-align:right;>批准：</td>
<td class=nb colspan=2></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb></td>
<td class=nb colspan=2 style=text-align:right;>制表人：</td>
<td class=nb colspan=2 style=text-align:left;>
<%
    string op = (string)this.Session["OperatorName"];
    if (op == null)
    {
        op = "";
    }
    Response.Write("<span style=display:none>"+op+"</span>");
%>
</td>
</tr>
</table>
</asp:Panel>
</form>
<form id="form2" method="post" action="/PageExport.ashx">
<input type="hidden" name="filename" value="日生产报表.xls" />
<input type="hidden" name="content" value="" />
</form>
<script type="text/javascript">
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
</script>
<script type="text/javascript">
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "textbox") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    //导出Excel
    function Export() {
        var code = document.getElementById("Panel2").innerHTML;
        form2.content.value =
"<html xmlns:o='urn:schemas-microsoft-com:office:office'\nxmlns:x='urn:schemas-microsoft-com:office:excel'\nxmlns='http://www.w3.org/TR/REC-html40'>\n<head>\n<meta http-equiv=Content-Type content='text/html; charset=utf-8'>\n<style>\n<!--table\n@page\n{margin:.12in .12in .12in .12in;\n mso-header-margin:.2in;\n mso-footer-margin:.2in;\n mso-page-orientation:landscape;\n mso-horizontal-page-align:center;\n mso-vertical-page-align:center;}\nbr{mso-data-placement:same-cell;}\n-->\n</style>\n<!--[if gte mso 9]><xml>\n<x:ExcelWorkbook>\n<x:ExcelWorksheets>\n<x:ExcelWorksheet>\n<x:Name>日生产报表</x:Name>\n<x:WorksheetOptions>\n<x:DefaultRowHeight>285</x:DefaultRowHeight>\n<x:Print>\n<x:ValidPrinterInfo/>\n<x:Scale>100</x:Scale>\n<x:PaperSizeIndex>9</x:PaperSizeIndex>\n<x:HorizontalResolution>200</x:HorizontalResolution>\n<x:VerticalResolution>200</x:VerticalResolution>\n</x:Print>\n<x:Selected/>\n<x:Panes>\n<x:Pane>\n<x:Number>3</x:Number>\n<x:ActiveRow>0</x:ActiveRow>\n<x:ActiveCol>0</x:ActiveCol>\n</x:Pane>\n</x:Panes>\n</x:WorksheetOptions>\n</x:ExcelWorksheet>\n</x:ExcelWorkbook>\n</xml><![endif]-->\n</head>\n<body>"
        + code + "</body></html>";
        form2.submit();
    }
</script>
</body>
</html>
